<template>
	<div class="agreeement">
		<div class="com-header border-1px">
			<div class="back"
				onclick="javascript:history.go(-1)"
			>
				<i class="iconfont">&#xe697;</i>
			</div>
			<div class="content" v-if="type == 1">
				{{agreeList.name || '暂无协议'}}
			</div>
			<div class="content" v-if="type == 2">
				{{unloginList.name || '无法登录'}}
			</div>
		</div>
		<div class="a-content" v-html="agreeList.content"  v-if="type == 1">
			
		</div>
		<div class="a-content" v-html="unloginList.content"  v-if="type == 2">
			
		</div>
		<div class="a-content"  v-if="type == 2 && !unloginList.content">
			<p  class="a-content-title">无法登录，请尝试验证码登录吧~</p>
		</div>
	</div>
</template>
<script>
	import { Toast } from 'mint-ui'
	import axios from 'axios'
	import Http from '../http.js'
	export default{
		data(){
			return{
				type: this.$route.params.id,
				agreeList: [],
				unloginList: []
			}
		},
		mounted(){
			if(this.type == 1){
				this.getData()
			}else if(this.type == 2){
				var params = new URLSearchParams();
	            params.append('type', 'unablelogin');
				axios.post(Http.RULECONTENT, params).then( res => {
	            	var ret =res.data;
	            	this.unloginList = ret['data']
	            })
			}
			
		},
		methods: {
			getData(){
				var params = new URLSearchParams();
                params.append('type', 'agreement');
				axios.post(Http.RULECONTENT, params).then( res => {
                	var ret =res.data;
                	this.agreeList = ret['data']
                })
			}
		}
	}
</script>
<style lang="scss" scoped>
	.com-header{
		position: fixed;
		top: 0;
		background: #fff;
		width: 100%;
	}
	.a-content{
		background: #f5f5f5;
		padding: 0.3rem 0.24rem;
		padding-top:0;
		.a-content-title{
			padding-top: 1rem;
		}
	}
</style>